<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="typeList">
      <el-table-column label="用工部门" align="center" prop="wspDeptPost.deptName" :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column label="用工岗位" align="center" prop="wspDeptPost.postName" :show-overflow-tooltip="true" />
      <el-table-column label="类型" align="center" prop="povertyType" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.wsp_poverty_type" :value="scope.row.povertyType"></dict-tag>
        </template>
      </el-table-column>
      <el-table-column label="开户银行" align="center" prop="bankName" :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column label="银行卡号" align="center" prop="cardNumber" :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column label="院系专业" align="center" prop="dm" :show-overflow-tooltip="true">
      </el-table-column>
      <el-table-column label="学生姓名" align="center" prop="studentName"></el-table-column>
      <el-table-column label="注册号" align="center" prop="regCode"></el-table-column>
      <el-table-column label="用工薪酬" align="center" prop="wspDeptPost.postComp">
        <template slot-scope="scope">
          {{ scope.row.wspDeptPost.postComp }}元/小时
        </template>
      </el-table-column>
      <el-table-column label="用工时长" align="center" prop="wspDeptPost.workHours">
        <template slot-scope="scope">
          {{ scope.row.wspDeptPost.workHours }}小时
        </template>
      </el-table-column>
      <el-table-column label="申请时间" align="center" prop="applyTime" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column label="审核时间" align="center" prop="apprTime" :show-overflow-tooltip="true"></el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" @click="handleDelete(scope.row)"
            v-hasPermi="['wsp:postemp:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import { getToken } from "@/utils/auth";
import { getSelector, consbasicList, consbasicAdd, updataConsbasic, getConsbasic, dateList, delConsbasic } from "@/api/psychological/basic"
import { postempList, postempDel } from '@/api/worStudy/postManagement'
export default {
  name: "Dict",
  dicts: ['sys_normal_disable','wsp_poverty_type'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      names: [],
      getTeacherList: [],
      timeVisibke: false,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      // 总条数
      total: 0,
      // 字典表格数据
      typeList: [],
      timeTab: [],
      timeTabList: [],
      dataTime: [],
      tiemTips: false,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  created() {
    getSelector().then(res => {
      this.getTeacherList = res.data
    })
  },
  methods: {
    /** 查询字典类型列表 */
    getList(data) {
      this.queryParams = data
      this.loading = true
      if (data.page || data.limit) {
        data.pageNum = data.page
        data.pageSize = data.limit
        this.queryParams.pageNum = data.page
        this.queryParams.pageSize = data.limit
      }
      postempList(data).then(response => {
        this.typeList = response.rows;
        console.log(this.typeList, 'this.typeList')
        this.total = response.total;
        this.loading = false;
      })
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id);
      this.name = selection.map(item => item.name);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.$modal
        .confirm('是否确认删除学生"' + row.studentName + '"的在岗数据项？')
        .then(function () {
          return postempDel(row.wpeId);
        })
        .then(() => {
          this.getList(this.queryParams);
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });

    },
  }
};
</script>
<style scoped>
::v-deep .avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 150px;
  height: 150px;
  line-height: 150px;
  text-align: center;
}

.avatar {
  width: 150px;
  height: 150px;
  display: block;
  border: 1px dashed red;
}

.uploaderText {
  display: flex;
}

.text {
  margin-left: 15px;
  line-height: 35px;
  color: #9A9A9A;
}

.container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

.left {
  width: 30%
}

.right {
  width: 65%
}
</style>